<template>
  <van-field
    v-model="fieldValue"
    :label="field.label"
    type="textarea"
    :placeholder="field.placeholder || `请输入${field.label}`"
    :rules="field.rules"
    :rows="field.rows || 2"
    :maxlength="field.maxlength"
    :show-word-limit="field.showWordLimit"
  />
</template>

<script setup>
import { computed } from "vue";

const props = defineProps({
  field: {
    type: Object,
    required: true,
  },
  modelValue: {
    type: String,
    default: "",
  },
});

const emit = defineEmits(["update:modelValue"]);

const fieldValue = computed({
  get: () => props.modelValue,
  set: (val) => emit("update:modelValue", val),
});
</script>
